<?php include './view/htm/header.inc.htm'; ?>

<div class="row">
    <div class="col-lg-10 offset-lg-1">
        <div class="card">
            <div class="card-block">
                <form action="<?php echo url("plugin-setting-xn_wechat_pay"); ?>" method="post" id="form">
                    <h4 class="card-title"><?php echo lang('wechat_pay'); ?></h4>
                    <div class="form-group row">
                        <label class="col-sm-2 form-control-label">mkid：</label>
                        <div class="col-sm-10">
                            <?php echo $input['wx_mkid']; ?>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-sm-2 form-control-label">mksecret：</label>
                        <div class="col-sm-10">
                            <?php echo $input['wx_mksecret']; ?>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-sm-2 form-control-label">充值比例：<br>Top-up proportion</label>
                        <div class="col-sm-10">
                            <?php echo $input['wx_mkpr']; ?>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-sm-2 form-control-label">二维码：</label>
                        <div class="col-sm-10">
                            <?php echo $input['wx_xcode']; ?>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-sm-2 form-control-label"></label>
                        <div class="col-sm-10">
                            <button type="submit" class="btn btn-primary btn-block" id="submit"
                                    data-loading-text="<?php echo lang('submiting'); ?>..."><?php echo lang('confirm'); ?></button>
                            <a role="button" class="btn btn-secondary btn-block m-t-1"
                               href="javascript:history.back();"><?php echo lang('back'); ?></a>
                        </div>
                    </div>
                </form>
            </div>
            <p class="m-a-1 small">绑定支付目录：http://<?php echo _SERVER('HTTP_HOST') . '/plugin/xn_wechat_pay/' ?></p>
            <p class="m-a-1 small">充值比例：1元=X金币,<i class="text-danger">如果充值比例为空或者0 则关闭支付。If the top-up proportion pay for empty or 0 is closed</i></p>
        </div>
    </div>
</div>

<?php include './view/htm/footer.inc.htm'; ?>

<script>

    var jform   = $("#form");
    var jsubmit = $("#submit");
    var referer = '<?php echo http_referer();?>';
    jform.on('submit', function () {
        jform.reset();
        jsubmit.button('loading');
        var postdata = jform.serialize();
        $.xpost(jform.attr('action'), postdata, function (code, message) {
            if ( code == 0 ) {
                $.alert(message);
                jsubmit.text(message).delay(2000).button('reset').location(referer);
                return;
            } else {
                $.alert(message);
                jsubmit.button('reset');
            }
        });
        return false;
    });

</script>